package cn.tao.user.controller;


import cn.tao.user.domain.User;
import cn.tao.user.service.IUserService;
import cn.tao.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @PostMapping("/verifyPhone")
    public AjaxResult verifyPhone(@RequestBody User user){

        User user1 = userService.loadByPhone(user.getPhone());
        if (user1==null){
            return AjaxResult.me();
        }else {
            return AjaxResult.me().setMessage("手机号已注册");
        }

    }

}
